package com.lab.book.common.dto;

import java.io.Serializable;

import javax.validation.constraints.Pattern;

import com.lab.cloud.common.validation.group.First;
import com.lab.cloud.common.validation.group.Second;
import org.hibernate.validator.constraints.Length;

import com.lab.book.common.validation.group.LoginGroup;
import com.lab.book.common.validation.group.RegisterGroup;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ApiModel(value = "用户登录对象")
@Data
public class LoginUserDTO implements Serializable{
	private static final long serialVersionUID = 2183625492819394382L;

	@ApiModelProperty(value = "用户名称", hidden = false, required = true)
	@Length(min =2, max = 16, message = "用户名2到16个字符", groups = { First.class, LoginGroup.class })
	private String name;
	
	@ApiModelProperty(value = "用户密码", required = true)
	@Pattern(regexp = "^[a-z0-9A-Z]{6,16}$", message = "密码为6到16位字母...", groups = { Second.class, LoginGroup.class,
			RegisterGroup.class })
	private String password;
}
